
<table style="width:800px;margin:auto" border="1">
  <caption>
    DANH SÁCH USER
  </caption>
    <br/>
    
    <div id="search_space">
        <input class="search" type="text" name="search" id="search" onkeypress="if(event.keyCode==13) window.location='?mod=user&kw='+this.value"></input>
        <a onclick="window.location='?mod=user&kw='+document.getElementById('search').value" href="#" class="searchbtn"></a>
    </div>
  <tr>
    <th width="58" scope="col">STT</th>
    <th width="219" scope="col">Tên User</th>
    <th width="101" scope="col">Email</th>
    <th width="140" scope="col">Công cụ</th>
  </tr>
<?php
    if(!empty($_GET['kw'])){    
        $kw = $_GET['kw'];
        echo $kw;
        $sql="select * from `user` where name like '%$kw%'";
    }else{
        $sql='select * from `user`';
    }
  
  $rs=mysqli_query($conn,$sql);
  $stt=1;
  
  while($r=mysqli_fetch_assoc($rs))
  {
?>
  <tr>
    <td align="center"><?php echo $stt++?></td>
    <td align="left">&nbsp;<?php echo $r['name']?></td>
    <td align="center">&nbsp;<?php echo $r['email']?></td>
    <td align="center"><a href="?mod=user_edit&idUser=<?php echo $r['id'] ?>"><img src="admin/img/b_edit.png" width="16" height="16" alt="Sửa"></a>&nbsp;<a onclick="return confirm('Bạn có chắc chắn muốn xóa hay không ?')" href="?mod=user_delete&idUser=<?php echo $r['id'] ?>"><img src="admin/img/b_drop.png" width="16" height="16" alt="Xóa"></a></td>
  </tr>
<?php
  }
?>
  <tr>
    <td colspan="6" align="center"><label>
      <input onClick="window.location='?mod=user_add'" type="button" name="user_add" id="user_add" value="Add New User">
    </label></td>
  </tr>
</table>
